package collection;

import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import java.util.TreeMap;

public class TestMap {
	public static void main(String[] args) {
		Map<String, String> map = new HashMap<String,String>();
		map.put("k1", "value1");
		map.put("k2", "value2");
		System.out.println(map.get("k1"));
		System.out.println(map.get("k2"));
		
		map.put("k2", "valueNew");
		System.out.println(map.get("k2"));
		
		map.remove("k2");
		
		for(String key:map.keySet()){
			System.out.println(key+":"+map.get(key));
		}
		
		
		Map<String, String> map2 = new TreeMap<String,String>();
		
		Map<String, String> map3 = new Hashtable<String,String>();//与hashset一样，但是线程安全
		
	}

}
